﻿using System;
using System.Linq;
using ASPNETVN.PORTAL.Components.UI;
using ASPNETVN.PORTAL.Components.Helpers;
using System.Net;
using System.IO;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using ASPNETVN.PORTAL.Components.Share;

namespace CDTM.Modules.ONLINE.Controls
{
    public partial class Style3 : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                GridDataBinding();
            }
        }

        private void GridDataBinding()
        {
            IList<Category> allCategories = Category.SelectCollectionAll(this.ModuleID);
            IList<Category> topCategories = allCategories.Where(x => x.ParentID != 0).OrderBy(x => x.SortOrder).ToList();

            rep.DataSource = topCategories;
            rep.DataBind();
        }

        protected void rep_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {

        }

        public string GetUrlManagerByCategory(int categoryID)
        {
            string urlManager = this.Settings["ONLINE.LinkManagement"].ToString() != "Default.aspx?tabid=" + Guid.Empty.ToString() ?
                    this.Settings["ONLINE.LinkManagement"].ToString() : "#";

            string url = ResolveUrl("~/" + urlManager + "&mid= " + this.ModuleID + "&categoryid=" + categoryID + "&page=" + "ItemManager");

            return url;
        }

    }
}